package com.ukao.cashregister.adapter;

import android.content.Context;
import android.widget.TextView;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.cashregister.R;
import com.ukao.cashregister.bean.TradeRecordBean;
import com.ukao.cashregister.utils.CheckUtils;
import com.ukao.cashregister.utils.MyDateUtils;

import java.util.List;

/**
 * 交易记录
 */

public class TradeRecordAdapter extends CommonAdapter<TradeRecordBean.ListBean> {



    public TradeRecordAdapter(Context context, List<TradeRecordBean.ListBean> datas) {
        super(context, datas, R.layout.adapter_consume_record);
    }


    @Override
    public void convert(ViewHolder holder, TradeRecordBean.ListBean item) {
        TextView    orderOriginText=holder.getView(R.id.orderOriginText);
        TextView    orderNo=holder.getView(R.id.orderNo);
        TextView    payMethodText=holder.getView(R.id.payMethodText);
        TextView    statusText=holder.getView(R.id.statusText);
        TextView    tradeTime=holder.getView(R.id.tradeTime);
        TextView    seq=holder.getView(R.id.seq);
        TextView    amount=holder.getView(R.id.amount);

        orderOriginText.setText(item.getOrderOriginText()+"下单");
        orderNo.setText("单号："+item.getOrderNo());
        payMethodText.setText(item.getPayMethodText()+"支付");
        statusText.setText(item.getStatusText());
        statusText.setTextColor(item.getStatus() == 1 ? mContext.getResources().getColor(R.color.green) : mContext.getResources().getColor(R.color.warm_red));
        seq.setText("支付流水："+item.getSeq());
        amount.setText( CheckUtils.isEmptyNumber(item.getAmount()));
        if(item.getTradeTime()!=0){
            tradeTime.setText("支付时间:"+MyDateUtils.formatDateCustom(item.getTradeTime(),"yyyy/MM/dd HH:mm:ss"));
        }






    }


}
